"""Agent基类定义"""

from abc import ABC, abstractmethod
from typing import Dict, Any, Optional, AsyncGenerator
import logging

logger = logging.getLogger(__name__)


class BaseAgent(ABC):
    """Agent基类"""
    
    def __init__(self, name: str, description: str):
        self.name = name
        self.description = description
        self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")
    
    @abstractmethod
    async def process_message(self, user_input: str, conversation_id: str,
                            user_id: Optional[str] = None, 
                            stream: bool = True) -> AsyncGenerator[Dict[str, Any], None]:
        """处理用户消息"""
        pass
    
    @abstractmethod
    def get_agent_info(self) -> Dict[str, Any]:
        """获取Agent信息"""
        pass
    
    async def health_check(self) -> Dict[str, Any]:
        """健康检查"""
        return {
            "agent_name": self.name,
            "status": "healthy",
            "description": self.description
        }
